package com.yuxi.Dao.Impl;

import java.io.Serializable;

import org.springframework.stereotype.Repository;

import com.yuxi.Dao.UserABMapDao;
import com.yuxi.Entity.ModifyInformationRecord;
import com.yuxi.Entity.UserABMap;
@Repository
public class UserABMapDaoImpl extends BaseDaoImpl<Serializable, Serializable> implements UserABMapDao {
		
	public UserABMapDaoImpl(){
		super(UserABMap.class);
	}
	@Override
	public UserABMap addUserABMap(UserABMap uMap) {
		return (UserABMap) super.addAndReturn(uMap);
	}

	@Override
	public UserABMap getUserABMapById(Integer uMapId) {		
		try{
			return (UserABMap) super.find("from UserABMap where id=?", uMapId).get(0);
		}catch(Exception e){
			return null;
		}
	}

	@Override
	public UserABMap getUserABMapByUserId(Integer userId) {
		try{
			return (UserABMap) super.find("from UserABMap where aUserId=? or bUserId=?",userId, userId).get(0);
		}catch(Exception e){
			return null;
		}
	}

	@Override
	public UserABMap getUserABMapByUserIdTwo(Integer userId, Integer userIdTwo) {
		try{		
			return (UserABMap) super.find("from UserABMap where aUserId=? and bUserId=?",userId, userIdTwo).get(0);
		}catch(Exception e){
			return null;
		}
	}

	@Override
	public void modifiUserMap(UserABMap uMap) {
		super.update(uMap);
	}
	@Override
	public void delUserMap(UserABMap uMap) {
		super.delete(uMap);		
	}

}
